from gamefunctions import *
import pygame
import speech

def gameMenu():
    menuIndex = ("play", "High scores", "Exit")
    i = 0
    msg = "Game Menu"
    msg = "Use up and down arrows to move through the menu.  Press enter on an option to select it."
    speech.speak(msg, False)
    while True:
        for event in pygame.event.get():
            #if the event is a valid keyboard input, move through the menu or select an option.
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_UP:
                    if i > 0: i -= 1
                    speech.speak(menuIndex[i])
                if event.key == pygame.K_DOWN:
                    if i < len(menuIndex) - 1: i += 1
                    speech.speak(menuIndex[i])
                if event.key == pygame.K_RETURN:
                    if i == 0: return "play"
                    if i == 2: return "exit"

